<?php
namespace BP\DA;
require_once("java/util/ArrayList.php");
require_once("java/util/Map.php");
class DataRowCollection 
// extends ArrayList 
{
	protected static $serialVersionUID;	// long
	protected $Table;	// DataTable
	public static function __staticinit() { // static class members
		self::$serialVersionUID = 1;
	}
	public static function constructor__DataTable ($table) // [DataTable table]
	{
		$me = new self();
		$me->Table = $table;
		return $me;
	}
	public function getTable () 
	{
		return $this->Table;
	}
	public function AddRow_DataRow ($vals) // [DataRow vals]
	{
			/* match: DataRow_I */
		return $this->AddRow_DataRow_I($vals, -1);
	}
	public function AddRow_DataRow_I ($vals, $idx) // [DataRow vals, int idx]
	{
		if (($vals == NULL))
			return NULL;
		$row = DataRow::constructor__DataTable($this->Table);
		$ap = ($vals);
		foreach ($this->Table->Columns as $dc) 		{
			$key = $dc->ColumnName;
			$valStr = $String->valueOf($ap->get($key));
			if (($valStr . NULL))
			{
				$valStr = "";
			}
			$row->setValue($key, $valStr);
		}
		if (($idx == -1))
			$this->add($row);
		else
			$this->add($row);
		return $row;
	}
	public function AddDatas ($vals) // [Object... vals]
	{
		if (($vals == NULL))
			return NULL;
		$row = DataRow::constructor__DataTable($this->Table);
		$i = 0;
		foreach ($vals as $val) 		{
			$key = $this->Table->Columns->get(++$i)->ColumnName;
			$value = null;
			if ($val instanceof Map)
			{
				$value = ($val)->get($key);
			}
			else
			{
				$value = $val;
			}
			if (($value == NULL))
				$value = "";
			$row->put($key, $value);
		}
		$this->add($row);
		return $row;
	}
}
DataRowCollection::__staticinit(); // initialize static vars for this class on load
?>
